import request from "@/api/request.js"

export const getAll=()=>{
    return request.post("/category/getAll")
}

export const addFirstService=(categoryFirstName)=>{
    const params = new URLSearchParams();
    params.append("categoryFirstName",categoryFirstName)
    return request.post("/category/addFirst",params)
}

export const selectAllFirstService=()=>{
    return request.post("/category/selectAllFirst")
}

export const addSecondService=(addCategoryDTO)=>{
    const params = new URLSearchParams();
    for (let key in addCategoryDTO){
        params.append(key,addCategoryDTO[key])
    }

    return request.post("/category/addSecond",params)
}

export const selectAllSecondService=()=>{
    return request.post("/category/selectAllSecond")
}

export const selectByPage=(pageNum,pageSize)=>{
    const params = new URLSearchParams();
    params.append("pageNum",pageNum)
    params.append("pageSize",pageSize)
    return request.post("/category/selectByPage",params)
}

export const deleteCategory=(categoryId,categoryLevel)=>{
    const params = new URLSearchParams();
    params.append("categoryId",categoryId)
    params.append("categoryLevel",categoryLevel)
    return request.post("/category/deleteCategory",params)
}